import { Column, Entity, Index, PrimaryGeneratedColumn } from "typeorm";

@Index("account", ["account"], { unique: true })
@Entity("admin", { schema: "frog_charge" })
export class Admin {
  @PrimaryGeneratedColumn({
    type: "smallint",
    name: "admin_id",
    unsigned: true,
  })
  adminId: number;

  @Column("char", {
    name: "account",
    unique: true,
    comment: "账号",
    length: 11,
  })
  account: string;

  @Column("char", { name: "password", comment: "密码", length: 32 })
  password: string;

  @Column("char", { name: "salt", length: 6 })
  salt: string;

  @Column("int", {
    name: "register_time",
    comment: "注册时间",
    unsigned: true,
    default: () => "'0'",
  })
  registerTime: number;

  @Column("int", {
    name: "last_login_time",
    comment: "最后登录时间",
    unsigned: true,
    default: () => "'0'",
  })
  lastLoginTime: number;
}
